package top.jnaw.jee.platform.model.Factory;

import top.jnaw.jee.platform.Consts.Result;
import top.jnaw.jee.platform.model.Approval;
import top.jnaw.jee.utils.ModelResult;

/**
 * Copyright (C) 2018 版权所有。
 * <p>
 * 文件名： 文件功能描述：
 *
 * @author lc  2018/8/15 10:55 创建内容：
 * <p>
 * <p>
 * 修改标识： 修改原因：
 */
public class LandApproval extends AbstractApproval {

  @Override
  public ModelResult rejected(Approval approval) {

    ModelResult result = new ModelResult(Result.kSuccess);
    if (result.fine()) {
      send(approval, false);
    }
    return result;
  }

  @Override
  public ModelResult passed(Approval approval) {

    ModelResult result = new ModelResult(Result.kSuccess);

    if (result.fine()) {

      send(approval, true);
    }
    return result;
  }

  private void send(Approval approval, boolean passed) {

    String type = "workStyle";

    String title = "工作风采审批";
    String operation = passed ? "通过" : "驳回";
    String approvalType = "工作风采添加申请";
    super
        .sendjpush(title, operation, approvalType, approval, type, "");
  }
}
